package com.tomdxz.serviceimpl;

import java.util.List;

import com.tomdxz.dao.UserDao;
import com.tomdxz.daoimpl.UserDaoImpl;
import com.tomdxz.model.User;
import com.tomdxz.service.UserService;

import net.sf.json.JSONObject;

public class UserServiceImpl implements UserService{

	UserDao uDao = new UserDaoImpl();
	
	@Override
	public JSONObject findUser(int page,int rows) {
		JSONObject j = new JSONObject();
		int total = uDao.getCountUser();
		List<User> user = uDao.getUser(page, rows);
		j.put("total", total);
		j.put("rows", user);
		return j;
	}

	@Override
	public int insertUser(String uaccount, String upsw, String uname, int rid) {
		
		return uDao.insertUser(uaccount, upsw, uname, rid);
	}

	@Override
	public int updateUserByUid(String uaccount, String upsw, String uname, int rid, int uId) {
		
		return uDao.updateUserByUid(uaccount, upsw, uname, rid, uId);
	}

}
